package tech.xs.auth.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.xs.auth.api.domain.bo.token.UpdateTokenBo;
import tech.xs.auth.service.AuthTokenService;
import tech.xs.common.framework.domain.model.ApiResult;

import javax.annotation.Resource;

@Slf4j
@Validated
@RestController
@RequestMapping("/token")
public class AuthTokenController {

    @Resource
    private AuthTokenService authTokenService;

    @PostMapping("/update/byUserId")
    public ApiResult<Void> updateToken(@RequestBody UpdateTokenBo bo) {
        authTokenService.updateToken(bo.getUserId());
        return ApiResult.success();
    }

}
